<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head>
</h:head>

<h:body>
	<ui:composition template="/WEB-INF/templates/homeTemplate.xhtml">

		<ui:define name="content">
			<h4>
				<h:outputText value="Test Master" />
			</h4>
			<h:form>
				<h:panelGrid columns="2" border="0" title="Registration Form"
					frame="above"
					columnClasses="lableCol,componentCol,validationMsgCol">

					<h:outputLabel value="Test Name : " />
					<h:inputText value="#{t.test.testName}" maxlength="200"/>

					<h:outputLabel value="Test Fee : " />
					<h:inputText value="#{t.test.testFee}" maxlength="7">
						
					</h:inputText>

					<h:outputText value=""/>
					<h:commandButton value="Save" action="#{t.addTest}" rendered="#{not t.test.editable}"/>
					<h:commandButton value="Update" action="#{t.updateTest(t.test)}"  rendered="#{t.test.editable}"/>
				</h:panelGrid>
			</h:form>

			<h:form>
				<h:dataTable value="#{t.getAllTests()}" var="te"
				styleClass="table-full"
				headerClass="table-header"
				columnClasses="table-odd-row,table-even-row">
					<h:column>
						<f:facet name="header">Sr. No.</f:facet>
					#{te.testId}
				</h:column>
					<h:column>
						<f:facet name="header">Test Name</f:facet>
    				#{te.testName}
    			</h:column>
					<h:column>
						<f:facet name="header">Test Fee</f:facet>
    				#{te.testFee}
    			</h:column>
					<h:column>
						<f:facet name="header">Action</f:facet>
						<h:commandLink value="Delete" action="#{t.deleteTest(te)}" />
					</h:column>
					<h:column>
						<f:facet name="header">Action</f:facet>
						<h:commandLink value="Edit" action="#{t.editTest(te)}" />
					</h:column>
				</h:dataTable>
			</h:form>
		</ui:define>

	</ui:composition>
</h:body>

</html>